﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Routing;
using System.Web.Mvc;
using Microsoft.Web.Mvc;
namespace Universum.Infrastructure.Configuration
{
	public static class RoutesConfiguration
	{
		public enum DefinedRoutes
		{
			Default,
			Search,
			Account,
			ResourceManager,
			UserPath,
			ReIndexing,
			Rss
		}
		public static void InitializeRoutes(RouteCollection routes){
			routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
			routes.IgnoreRoute("content/{*pathInfo}");
			var value = DefinedRoutes.Default.ToString();
			routes.MapRoute(
				DefinedRoutes.Default.ToString(),
				"Home/{action}",
				new { controller = "Home", action = "Index" }
				);
			routes.MapRoute(
				DefinedRoutes.Search.ToString(),
				"Search/{action}",
				new { controller = "Search", action = "Index" }
				);
			routes.MapRoute(
				DefinedRoutes.Rss.ToString(),
				"Rss/{action}",
				new { controller = "Rss", action = "Content" }
				);
			routes.MapRoute(
				DefinedRoutes.ReIndexing.ToString(),
				"ReIndexing/{action}",
				new { controller = "ReIndexing", action = "Index" }
				);
			routes.MapRoute(
				DefinedRoutes.Account.ToString(),
				"Account/{action}/{id}",
				new { controller = "Account", action="LogOn",id="" }
				);
			routes.MapRoute(
				DefinedRoutes.ResourceManager.ToString(),
				"{username}/Resource/{action}/{path}/{file}",
				new
				{
					username="anonymous",
					controller = "Resource",
					action = "Index",
					path = "",
					file = ""
				});
			
			
			routes.MapRoute(DefinedRoutes.UserPath.ToString(),
				"{username}/{controller}/{action}/{id}",
				new { username="anonymous", controller = "Home", action = "Index", id = "" });
		}
	}
}
